package com.c.yinyuezhushou.Dialog;

import android.content.Context;
import android.os.Bundle;
import android.view.Gravity;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;

import com.c.yinyuezhushou.R;

public class LoadingDialog extends AlertDialog {
    boolean cancelable;
    private TextView textView;


    public LoadingDialog(@NonNull Context context, boolean cancelable, @Nullable OnCancelListener cancelListener) {
        super(context, cancelable, cancelListener);
        this.cancelable = cancelable;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_loading);

        setCancelable(cancelable);
        Window window = getWindow();
        window.setBackgroundDrawableResource(R.color.touming);

        WindowManager.LayoutParams params = window.getAttributes();

        params.gravity = Gravity.CENTER;

        window.setAttributes(params);

        textView = findViewById(R.id.dl_text1);
    }

    public void setTitle(String title) {
        textView.setText(title);
    }
}
